-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent error when forwarding user attributes to kits while kit … #947
fix: prevent error when forwarding user attributes to kits while kit … #947
Conversation
src/kitBlocking.ts
Outdated
} | ||
if (!matchedAttributes[key]) { | ||
return true | ||
var matchedAttributes = this.dataPlanMatchLookups['user_attributes']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var matchedAttributes = this.dataPlanMatchLookups['user_attributes']; | |
const matchedAttributes = this.dataPlanMatchLookups['user_attributes']; |
src/kitBlocking.ts
Outdated
return false | ||
} | ||
|
||
if (this.blockUserAttributes && typeof matchedAttributes === "object") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is checking this.blockUserAttributes
necessary? We're already checking for it's existence a few lines earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was actually thinking about that and it did seem redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a test added to this that fails with the previous code, but passes with the current code.
b6883b6
to
b8a1a8f
Compare
964fb18
to
1e5077a
Compare
@rmi22186 @alexs-mparticle - added unit test and confirmed it was passing with my code change in KitBlocking.ts and was failing when testing the old code prior to my changes |
test/src/tests-kit-blocking.ts
Outdated
expect(() => { kitBlocker.isAttributeKeyBlocked('unplannedAttr') }).to.not.throw(TypeError, /Cannot read properties of undefined \(reading 'unplannedAttr'\)/) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add another expect for kitBlocker.isAttributeKeyBlocked('unplannedAttr' to equal true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the case and confirmed this should be expected to be false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments, otherwise lgtm!
f03c5ed
to
3df8d84
Compare
…blocking enabled and unplanned UAs are allowed
Co-authored-by: Robert Ing <[email protected]>
Co-authored-by: Robert Ing <[email protected]>
Co-authored-by: Robert Ing <[email protected]>
1879acd
to
f686ce7
Compare
Quality Gate passedIssues Measures |
## [2.31.1](v2.31.0...v2.31.1) (2025-01-06) ### Bug Fixes * Check for uploader to prevent errors when calling upload() too early ([#938](#938)) ([4342b0a](4342b0a)) * Forward user attributes to kits properly when kit blocking is enabled and unplanned UAs are allowed ([#947](#947)) ([fdbc6ba](fdbc6ba))
🎉 This PR is included in version 2.31.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
…blocking enabled and unplanned UAs are allowed
Summary
Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)